package com.xp.code.view;

import javax.annotation.Resource;

import net.sf.json.JSONObject;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ModelDriven;
import com.xp.code.servicesImpl.PostInfoService;
import com.xp.code.vo.PostInfoVO;

/**
 * 
 * @author HAHA
 *
 */
@Controller("postInfoAction")
@Scope("prototype")
public class PostInfoAction extends XPInfoAction implements ModelDriven<PostInfoVO>{

	private PostInfoVO postInfoVO;
	@Resource(name="postInfoService")
	private PostInfoService postInfoService;
	
	public PostInfoAction() {
		
	}

	public PostInfoVO getModel() {
		postInfoVO =new PostInfoVO();
		return postInfoVO;
	}

	public PostInfoService getPostInfoService() {
		return postInfoService;
	}

	public void setPostInfoService(PostInfoService postInfoService) {
		this.postInfoService = postInfoService;
	}

	public String addPostInfos()throws Exception{
		PostInfoVO vo=postInfoService.addPostInfos(postInfoVO);
		JSONObject jo=JSONObject.fromObject(vo);
		setJsonString(jo.toString());
		return SUCCESS;
	}
}
